﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;
using PdfWizard.UI.Services;

namespace PdfWizard.UI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.Presenter = ServiceLocator.Current.GetInstance<MainWindowPresenter>();

            InitializeComponent();
        }

        /// <summary>
        /// Handles the KeyUp event of the fileListView control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Input.KeyEventArgs"/> instance containing the event data.</param>
        private void fileListView_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                for (int i = fileListView.SelectedItems.Count-1; i >= 0 ; i--)
                {
                    this.Presenter.Files.Remove((FileInfo)fileListView.SelectedItems[i]);

                }
            }
        }

        /// <summary>
        /// Gets or sets the presenter.
        /// </summary>
        /// <value>The presenter.</value>
        public MainWindowPresenter Presenter { get; set; }

    }
}
